<template>
    <view class="pub_page pub_tuanz_manage pub_header_padding">
        <pub-head :headerConfig="headerConfig" @headerBack="headerBack"></pub-head>
        <div class="pub_page_scroll page_box" v-if="teamInfo!=''">
            <z-paging ref="Zpaging" class="box_container" v-model="teamList" @query="getTeamList"
                :refresher-enabled="false" :fixed="false" :hide-empty-view="true">
                <div class="nums_div">
                    <div class="num_1">
                        <div class="li">
                            <div class="txt">今日奖励</div>
                            <div class="num">{{ teamInfo.dayReward || 0 }}</div>
                        </div>
                    </div>
                    <div class="num_1">
                        <div class="li">
                            <div class="txt">本月奖励</div>
                            <div class="num">{{ teamInfo.monthReward || 0 }}</div>
                        </div>
                        <div class="li">
                            <div class="txt">累计奖励</div>
                            <div class="num">{{ teamInfo.totalReward || 0 }}</div>
                        </div>
                    </div>
                </div>
                <div class="texts_div">
                    <div class="li">
                        <div class="p_1">当前团长级别</div>
                        <div class="p_2">团长</div>
                    </div>
                    <div class="li">
                        <div class="p_1">申请时间</div>
                        <div class="p_2">{{ teamInfo.createDate }}</div>
                    </div>
                    <div class="li">
                        <div class="p_1">所属区域</div>
                        <div class="p_2">{{ `${teamInfo.province}${teamInfo.city}${teamInfo.region}` }}</div>
                    </div>
                    <div class="li">
                        <div class="p_1">直推人数</div>
                        <div class="p_2">{{ teamInfo.directChildNum || 0 }}</div>
                    </div>
                    <div class="li">
                        <div class="p_1">推荐商家</div>
                        <div class="p_2">{{ teamInfo.merchantNum || 0 }}</div>
                    </div>
                    <div class="li">
                        <div class="p_1">团队人数</div>
                        <div class="p_2">{{ teamInfo.teamNum || 0 }}</div>
                    </div>
                </div>
                <div class="zt_lis_div">
                    <div class="title">直推列表</div>
                    <div class="tr th">
                        <div class="td">头像</div>
                        <div class="td">昵称</div>
                        <div class="td">电话号码</div>
                        <div class="td">推广时间</div>
                    </div>
                    <div class="pub_nodata_1" v-if="teamList.length==0">空空如也~~</div>
                    <div class="tr" v-for="(li, key) in teamList" :key="key">
                        <div class="td">
                            <pub-image class="headimg" :src="li.avatar" mode="aspectFill" />
                        </div>
                        <div class="td td_nickname">{{ li.nickName }}</div>
                        <div class="td">{{ li.mobile }}</div>
                        <div class="td">{{ li.createTime.substring(0,11) }}</div>
                    </div>
                </div>
            </z-paging>
        </div>
    </view>
</template>

<script>
export default {
    data() {
        return {
            headerConfig: {
                title: '团长管理中心',//标题栏内容
                left_type: 3,
                header_color: '#fff',
                title_color: '#000',
                left_content: 'dark',
            },

            teamInfo: '',
            teamList: []
        };
    },
    computed: {

    },
    onLoad() {
        this.getTeamInfo()
        setTimeout(() => {
            this.$comFun.openLoading();
            this.$refs.Zpaging.reload()
        }, 400);
    },
    onShow() {
    },
    methods: {
        async getTeamInfo() {
            const res = await this.$request.get('user/getTeamLeaderInfo');
            if (res.code == 200) {
                this.teamInfo = {
                    ...res.result,
                    createDate: res.result?.createTime?.substring(0, 10) || ''
                };
            }
            const res_1 = await this.$request.get('user/myTeam');
            if (res_1.code == 200) {
                this.teamInfo = {
                    ...this.teamInfo,
                    ...res_1.result,
                };
            }
        },
        async getTeamList(pageNo, pageSize) {
            let data = {
                pageNo: pageNo,
                pageSize: pageSize,
            };
            const res = await this.$request.get('user/myChildPage', data);
            this.$comFun.closeLoading();
            // console.log(res);
            if (res.code == 200) {
                this.$refs.Zpaging.complete(res.result.records);
            } else {
                this.$refs.Zpaging.complete(false);
            }
        }
    },
};
</script>

<style lang="scss" scoped>
@import "@/common/css/mine.scss";
</style>
